package com.wnxy.eleba.mapper;

import com.wnxy.eleba.entity.Rider;
import com.wnxy.eleba.vo.RiderQueryParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 骑手映射器
 *
 * @author AndyZhou
 * @date 2021-11-10 01:07:04
 */
public interface RiderMapper {
    /**
     * 按主键删除
     * delete by primary key
     *
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * 插入
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(Rider record);

    /**
     * 插入选择性
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(Rider record);

    /**
     * 选择通过主键
     * select by primary key
     *
     * @param id primary key
     * @return object by primary key
     */
    Rider selectByPrimaryKey(Integer id);

    /**
     * 更新主键的选择性
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(Rider record);

    /**
     * 更新的主键
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(Rider record);

    /**
     * 找到所有的车手的名字和骑手密码
     *
     * @param riderName     骑士的名字
     * @param riderPassword 骑手的密码
     * @return {@link List}<{@link Rider}>
     */
    List<Rider> findAllByRiderNameAndRiderPassword(@Param("riderName")String riderName,@Param("riderPassword")String riderPassword);

    /**
     * 找到的条件
     * 封装实体类模糊查询
     *
     * @param rider 骑手
     * @return {@link List}<{@link Rider}>
     */
    List<Rider> findByCondition(Rider rider);

    /**
     * 找到乘客
     * 传形参动态模糊找到骑手
     *
     * @param riderName   骑士的名字
     * @param riderMobile 骑士电话
     * @return {@link List}<{@link Rider}>
     */
    List<Rider> findRiders(@Param("riderName")String riderName,@Param("riderMobile")String riderMobile);

    int deleteByIds(@Param("ids") Integer[] ids);

    List<Rider> selectRiderByCondition(RiderQueryParam riderQueryParam);
}
